{include file="common/head"}

<head>
	<style>
		div {
			border: 0 solid #ccc;
		}

		#top {
			height: 90px;
			padding: 0 10px;
		}

		#content {
			min-height: 700px;
		}

		.top_menu {
			font-style: bold;
			background-color: ;
			cursor: pointer;
		}

		.second_menu {
			padding-left: 30px;
			cursor: pointer;
		}

		.menu_active {
			color: #006;
			font-weight: bold;
			background-color: #f7f7f7;
		}

		a {
			text-decoration: none;
		}

		#bottom {
			text-align: center;
		}

		#msg_count {
			position: absolute;
			top: 0;
			right: 0;
			background: red;
			color: #fff;
			border-radius: 50%;
			width: 24px;
			height: 24px;
			text-align: center;
			line-height: 24px;
		}
	</style>
</head>

<body style="background-image: url({$sys.background_image});">
	<div class="container-fluid">
		<div id="top" class="row">
			<div class="col-1">
				<image src="/upload/logo.png" class="logo" style="height:86px;left:10px;" />
			</div>
			<div class="col-8" style="text-align: left;">
				<h1 class="text-primary" style="line-height: 85px;">
					{$sys.company_name}{$sys.sys_name}
				</h1>
			</div>
			<div class="col-3 text-center">
				<div style="font-size: larger;line-height: 85px;position: relative;">
					<c><span class="bi-person-circle"></span>{$uname}</c>&nbsp;
					<c><span class="bi-box-arrow-right"></span><a
							href="/index.php/login/logout/target/admin">退出系统</a></span>&nbsp;
						<c><span class="bi-list-task"></span><a href="#" id="show_menu">隐藏菜单</a></c>
				</div>
			</div>


		</div>

		<div style="height: 100px;"></div>
		<div id="content" class="row">
			<div id="left" class="col" style="max-width:200px;">
				<ul class="list-group list-group-flush">
					{foreach $menu as $val}
					<li class="list-group-item {$val.class} " url="{$val['url_key']}"
						menu_id="{$val['id']}">
						{if $val['url_key']=='msg/index'}<div id="msg_count">0</div>{/if}
						<span class="{$val['icon']}"></span>
						{if $val['url_key']}
						<a href="/{$val['url_key']}" target="to">{$val.name}</a>
						{else}
						{$val.name}
						{/if}
					</li>
					{/foreach}
				</ul>

			</div>

			<div id="right" class="col">

				<iframe src="" frameborder="0" name="to"
					style="border: 1px solid #ccc;width:100%;height:100%;"></iframe>

			</div>

		</div>
		<div style="height: 60px;"></div>
		<div id="bottom">
			<c class="text-info">Copy_right:{$sys.copy_right} </c>
			<a href="https://beian.miit.gov.cn/">浙ICP备2023021152号-1</a>
		</div>
	</div>


	<script type="text/javascript">
		$(document).ready(function () {

			function ajax_breath() {
				$.post('/admin/ajax_breath', function (res) {
					console.log(res);
					if (!res.code) {
						location.href = "/login/index/target/admin";
					}
				});
			}
			setInterval(ajax_breath, 30000);

			function msgs() {
				$.post('/index.php/msg/msg_count', function (res) {
					//console.log(res);
					if (res.count > 0) {
						$("#msg_count").text(res.count);
					}
				});
			}



			$("#show_menu").on('click', function () {
				if ($(this).html() == '隐藏菜单') {
					$(this).html('显示菜单');
				} else {
					$(this).html('隐藏菜单');
				}
				$("#left").toggle('fast');
			})

			//左侧菜单处理
			$(".top_menu").addClass('list-group-item-primary').on('click', function (e) {
				var fid = $(this).attr('menu_id');
				$(".second_menu").slideUp(100)
				$(".fid_" + fid).slideDown(100);
				
			});

			//菜单事件
			$(".second_menu").on('click', function (e) {
				$(".second_menu").removeClass("menu_active");
				$(this).toggleClass("menu_active");
			});
			//动态组件的事件
			$("#table_list").on('click', ".edit", function (e) {
				window.location.href = $(this).attr('url');
			})

			$("iframe").attr('src', '/admin/home');

		});
	</script>
</body>

</html>